package main

import (
	"fmt"
	"go-guide/rpc/net/proto"
	"go-guide/rpc/net/tcp/constant"
	"net"
)

func main() {

	conn, err := net.Dial(constant.NetWorkType, constant.Address)

	if err != nil {
		fmt.Printf("dial provider error = %v", err)
		return
	}

	request := proto.HelloRequest{
		Username: "jack",
	}
	bytes, _ := request.XXX_Marshal(nil, false)
	n, err := conn.Write(bytes)

	if err != nil {
		fmt.Printf("send message failed error = %v", err)
		return
	}

	fmt.Printf("send bytes length = %d", n)
}
